$primary: #4096FF;
$primaryHover: #69B1FF;
$primaryActive: #0958d9;

$gray: #D9D9D9;

$danger: #FF4D4F;
$dangerHover: #FF7875;
$dangerActive: #D9363E;

.button {
  /*reset*/
  outline: none;
  display: inline-block;
  position: relative;
  font-weight: 400;
  white-space: nowrap;
  background-image: none;
  background-color: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  line-height: 22px;

  padding: 4px 15px;
  border-radius: 6px;
  font-size: 14px;
  height: 32px;

  &.small {
    height: 24px;
    padding: 0 7px;
    border-radius: 4px;
  }

  &.large {
    height: 40px;
    font-size: 16px;
    padding: 6px 15px;
    border-radius: 8px;
  }

  &.disabled {
    cursor: default;
  }

  &.default {
    background-color: #FFF;
    border-color: $gray;

    &:hover {
      color: $primaryHover;
      border-color: $primaryHover;
    }

    &:active {
      color: $primaryActive;
      border-color: $primaryActive;
    }

    &.disabled {
      opacity: .85;
      &:hover {
        color: $gray;
        border-color: $gray;
      }
    }

    & .shadow {
      background-color: $primary;
    }

    &.danger {
      color: $danger;
      border-color: $danger;
      &:hover {
        color: $dangerHover;
        border-color: $dangerHover;
      }
      &:active {
        color: $dangerActive;
        border-color: $dangerActive;
      }

      & .shadow {
        background-color: $danger
      }
    }
  }

  &.primary {
    color: #FFF;
    background: #1677ff;
    border-color: transparent;

    &:hover {
      background-color: $primaryHover;
    }

    &:active {
      background-color: $primaryActive;
    }
    &.disabled {
      opacity: .65;
      &:hover {
        color: #FFF;
        background-color: $primary
      }
    }
    & .shadow {
      background-color: $primary;
    }
    &.danger {
      background-color: $danger;
      &:hover {
        background-color: $dangerHover;
      }
      &:active {
        background-color: $dangerActive;;
      }
      & .shadow {
        background-color: $danger;
      }
    }
  }

  &.dashed {
    background-color: #FFF;
    border-color: $gray;
    border-style: dashed;
    &:hover {
      color: #4096FF;
      border-color: $primaryHover;
    }
    &:active {
      color: $primaryActive;
      border-color: $primaryActive;
    }
    &.disabled {
      opacity: 0.85;
      &:hover {
        color: $gray;
        border-color: $gray;
      }
    }
    & .shadow {
      background-color: $primary
    }
    &.danger {
      color: $danger;
      border-color: $danger;
      &:hover {
        color: $dangerHover;
        border-color: $dangerHover;
      }
      &:active {
        color: $dangerActive;
        border-color: $dangerActive;
      }
      & .shadow {
        background-color: $danger
      }
    }

  }

  &.ghost {}

  &.text {
    color: #333;
    &:hover {
      color: rgba(0, 0, 0, 0.88);
      background-color: rgba(0, 0, 0, 0.06);
    }
    &:active {
      color: rgba(0, 0, 0, 0.88);
      background-color: rgba(0, 0, 0, 0.15);
    }
    &.disabled {
      opacity: 0.85;
      &:hover {
        color: #ccc;
        background-color: transparent;
      }
    }
    & .shadow {
      background-color: #333;
    }

    &.danger {
      color: $danger;
      background-color: transparent;
      &:hover {
        color: $dangerHover;
      }
      &:active {
        color: $dangerActive;
      }
      & .shadow {
        background-color: $danger;
      }
    }
  }

  &.link {
    color: $primary;

    &:hover {
      color: $primaryHover;
    }
    &:active {
      color: $primaryActive;
    }
    &.disabled {
      opacity: 0.85;
      &:hover {

      }
    }
    &.danger {
      color: $danger;

      &:hover {
        color: $dangerHover
      }
      &:active {
        color: $dangerActive;
      }
    }
  }

  .shadow {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    opacity: 0.3;
    animation: wave 0.5s 1 forwards;
  }

  &> .icon + span {
    margin-left: 8px;
  }
}

@keyframes wave {
  from {
    transform: scale(1);
    opacity: 0.3;
  }
  to {
    transform: scale(1.2);
    opacity: 0;
  }
}